import requests

# @app.post("/process_image/")

# process_url = 'http://127.0.0.1:8000/process_image/'
# user_string = 1713251553  # 要传递的用户
#
# response = requests.post(process_url, params={'user_string': user_string})
#
# if response.status_code == 200:
#     print(response.text)
# else:
#     print('Failed to process image')


# @app.post("/upload_image/")

# upload_url = 'http://127.0.0.1:8000/upload_image/'
# image_filename = 'D:\桌面\image_0.png'
# files = {'image': open(image_filename, 'rb')}
# response = requests.post(upload_url, files=files)
# print(response.text)
# if response.status_code == 200:
#     print("upload image sucess")
# else:
#     print('Failed to upload image')


# @app.post("/list_images/")

# process_url = 'http://127.0.0.1:8000/list_images/'
# user_string = 1713251553  # 要传递的用户
#
# response = requests.get(process_url, params={'user_string': user_string})
#
# if response.status_code == 200:
#     print(response.text)
# else:
#     print('Failed to process image')


# @app.post("/upload_image/")
# import cv2 as cv
# import numpy as np
# upload_url = 'http://0.0.0.0:30002/run/optovue/five/opti/'
# image_filename = '/home/imed/Desktop/oct5-thick-layer-analysis/server/user_color_data/1713251553/image_0.png'
# files = {'file': open(image_filename, 'rb')}
# response = requests.post(upload_url, files=files)
# with open("raw.png", 'wb') as r_f:
#     r_f.write(response.content)
#
# color_list = [(0, 0, 255), (255, 0, 0), (0, 255, 0), (192, 255, 0), (0, 255, 156)]
#
# ori_img = cv.imread("raw.png")
# zero_img = np.zeros_like(ori_img, dtype=np.uint8)
# ori_img = ori_img[:, :, 0]
#
# for i in range(1, 6):
#     zero_img[np.where(ori_img == i)] = color_list[i - 1]
#
# cv.imwrite("color.png", zero_img)



# # @app.post("/mix_together/")
#
# process_url = 'http://127.0.0.1:8000/mix_together/'
# user_string = 1713251553  # 要传递的用户
# base_image_name = "control04_HD_Angio_Retina_OD-1.png"
# response = requests.post(process_url, params={'user_string': user_string,'base_image_name':base_image_name})
#
# if response.status_code == 200:
#     print(response.text)
# else:
#     print('Failed to process image')

# @app.post("/mix_images/")

process_url = 'http://127.0.0.1:8000/mix_images/'
user_string = 1713251553  # 要传递的用户
base_image_name = "control04_HD_Angio_Retina_OD-1.png"
response = requests.post(process_url, params={'user_string': user_string,'base_image_name':base_image_name})

if response.status_code == 200:
    print(response.text)
else:
    print('Failed to process image')